/**
 *
 * 游戏结束界面
 *
 */
class GameOverPanel extends BasePanel{
    public constructor(){
        super();
    }
	
    private bg: egret.Bitmap;
    private acceptBtn: EButton;
    private menueBtn: EButton;
    private retryBtn: EButton;
	
    // 初始化面板
    public initPanel():void{
        this.bg = new egret.Bitmap();
        this.bg.texture = this.assets.getTexture("alertBg");
        this.bg.x = this.w / 2 - this.bg.width / 2;
        this.bg.y = this.h / 2 - this.bg.height / 2 - 10;
        this.addChild(this.bg);
        this.bg.touchEnabled = true;


        this.acceptBtn = new EButton(this,"cancelBtn",this.acceptBtnHandle);
        this.acceptBtn.x = this.bg.x + this.bg.width / 2 - this.acceptBtn.width / 2;
        this.acceptBtn.y = this.bg.y + this.bg.height - this.acceptBtn.height / 2 - 10;
        this.addChild(this.acceptBtn);


        this.menueBtn = new EButton(this,"menueBtn",this.menueBtnHandle);
        this.menueBtn.x = this.acceptBtn.x + 57;
        this.menueBtn.y = this.acceptBtn.y - 87;
        this.addChild(this.menueBtn);


        this.retryBtn = new EButton(this,"retryBtn",this.retryBtnHandle);
        this.retryBtn.name = "retryBtn";
        this.retryBtn.x = this.acceptBtn.x - 57;
        this.retryBtn.y = this.acceptBtn.y - 87;
        this.addChild(this.retryBtn);

    }
    private acceptBtnHandle(): void {
        Global.dispatchEvent(MainNotify.closeGameOverPanelNotify);
    }

    private menueBtnHandle(): void {
        Global.dispatchEvent(MainNotify.closeGameOverPanelNotify);
    }

    private retryBtnHandle(): void {
        Global.dispatchEvent(MainNotify.closeGameOverPanelNotify);
        GameManager.i.GameReStart();
    }


}